package com.googlecode.curvedmetromaps.core.logic.localsearch.geneticalgorithm;

import java.util.ArrayList;

import com.googlecode.curvedmetromaps.core.logic.costfunction.CostSystem;
import com.googlecode.curvedmetromaps.core.model.MetroMap;

public class Population {
	ArrayList<Organism>	organisms;

	/**
	 * Initiate the population
	 * @param initialMap The map to start from.
	 * @param n The number of individuals to generate.
	 */
	public Population(MetroMap initialMap, int n) {
		CostSystem costSystem = new CostSystem(initialMap);
		double cost = costSystem.calculateCostSum();
		
		organisms = new ArrayList<Organism>(n);
		for (int i = 0; i < n; i++) {
			Organism o = new Organism(initialMap);
			o.cost = cost; 
			organisms.add(o);
		}
	}
}
